/*
 * This file is part of aion-engine <aion-engine.com>
 *
 * aion-engine is private software: you can redistribute it and or modify
 * it under the terms of the GNU Lesser Public License as published by
 * the Private Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * aion-engine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser Public License for more details.
 *
 * You should have received a copy of the GNU Lesser Public License
 * along with aion-engine.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.aionengine.gameserver.model.templates.itemgroups;

import com.aionengine.gameserver.model.templates.rewards.BonusType;
import com.aionengine.gameserver.model.templates.rewards.IdReward;

import javax.xml.bind.annotation.*;

/**
 * @author Rolandas
 *
 */

/**
 * <p/>
 * Java class for ItemGroup complex type.
 * <p/>
 * The following schema fragment specifies the expected content contained within this class.
 * <p/>
 * <pre>
 * &lt;complexType name="ItemGroup">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;attribute name="bonusType" use="required" type="{}BonusType" />
 *       &lt;attribute name="chance" type="{http://www.w3.org/2001/XMLSchema}float" default="0" />
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ItemGroup")
@XmlSeeAlso({CraftItemGroup.class, CraftRecipeGroup.class, ManastoneGroup.class, FoodGroup.class, MedicineGroup.class,
        OreGroup.class, GatherGroup.class, EnchantGroup.class, BossGroup.class})
public abstract class ItemGroup {

    @XmlAttribute(name = "bonusType", required = true)
    protected BonusType bonusType;

    @XmlAttribute(name = "chance")
    protected Float chance;

    /**
     * Gets the value of the bonusType property.
     *
     * @return possible object is {@link BonusType }
     */
    public BonusType getBonusType() {
        return bonusType;
    }

    /**
     * Gets the value of the chance property.
     *
     * @return possible object is {@link Float }
     */
    public float getChance() {
        if (chance == null) {
            return 0.0F;
        } else {
            return chance;
        }
    }

    public abstract IdReward[] getRewards();

}
